package com.zhangdi.dwperms.token;

import com.zhangdi.dwperms.enums.LoginType;

public class TokenFactory {
    public static AuthToken build(LoginType loginType, String principal, String credentials) {
        if (loginType == LoginType.account) {
            MSToken token = new MSToken();
            token.setLoginType(LoginType.account);
            token.setPrincipal(principal);
            token.setCredentials(credentials);
            return token;
        } else if (loginType == LoginType.wx) {
            MSToken token = new MSToken();
            token.setLoginType(LoginType.wx);
            token.setPrincipal(principal);
            token.setCredentials(credentials);
            return token;
        }

        return null;
    }
}
